<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\modules\taxonomy\search\TaxonomyCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '分类管理';
$this->params['breadcrumbs'][] = $this->title;

?>

<p>
    <?= Html::a('新建', ['create'], ['class' => 'btn btn-primary']) ?>
</p>
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    //'filterModel' => $searchModel,
    'layout' => "{items}\n{pager}",
    'columns' => [
        [
          'class'=>'common\grid\TextIdColumn',
        ],
        [
            'class'=>'common\grid\DataColumn',
            'attribute'=>'name',
            'format'=>'html',
            'width'=>'250px',
            'value'=>function ($model,$key,$index,$column)
            {

                return Html::a($model->name,['/taxonomy/taxonomy/index','category'=>$model->id]);
            }
        ],
        [
            'class'=>'common\grid\DataColumn',
            'attribute'=>'description',
            'width'=>'auto',
        ],
        [
			'class' => 'yii\grid\ActionColumn',
			'buttons'=>[
			    'view'=>function ($url, $model, $key){
					return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', Url::to(['taxonomy/index','category'=>$key]), [
						'title' => Yii::t('yii', 'View'),
						'data-pjax' => '0',
					]);
				}
			],
		],
    ],
]); ?>


